﻿<%@ Page Language="C#" MasterPageFile="~/Templates/Member.master" AutoEventWireup="true" CodeFile="MemberPassword.aspx.cs" Inherits="MemberPassword" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <div style="height:500px;width:100%;">
        <div style="width:100%; background-color:#F3F8FE; height:25px; color:#014D7F; padding-top:5px;">&nbsp; &nbsp;修改密码</div>
        <div>
            <div id="divContent" style="margin-left:50px; margin-top:20px;">
                
                <table cellpadding="0" cellspacing="0" border="0">
                    <tr style="height:30px;"><td style="width:100px;" align="right">用户名：</td> <td>
                        <asp:Label ID="lblName" runat="server" Text="" ForeColor="#FF6600"></asp:Label></td>
                        <td style="width:260px;"></td>
                    </tr>
                    <tr style="height:30px;"><td align="right">原始密码：</td><td>
                        <asp:TextBox ID="txtOldPwd" TextMode="Password" onblur="checkPwd(this,'msgOldPwd')" runat="server"></asp:TextBox></td>
                        <td><div id="msgOldPwd" ></div></td>    
                    </tr>  
                    <tr style="height:30px;"><td align="right">新密码：</td><td>
                            <asp:TextBox ID="txtNewPwd" TextMode="Password" onblur="checkPwd(this,'msgNewPwd')" runat="server"></asp:TextBox></td>
                        <td><div id="msgNewPwd" ></div></td> 
                    </tr>
                    <tr style="height:30px;"><td align="right">确认密码：</td><td>
                            <asp:TextBox ID="txtNewPwd1" TextMode="Password" onblur="checkPwd2(this,'mgsNewPwd2')" runat="server"></asp:TextBox></td>
                        <td><div id="mgsNewPwd2" ></div></td> 
                    </tr>
                    <tr style="height:40px;"><td colspan="3" align="left" style="color:#ff0000;" >
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<asp:Button ID="Button1" CssClass="short-btn" OnClientClick="return CheckForm();" runat="server" Text="确定" OnClick="Button1_Click" /> &nbsp;
                        <asp:Label ID="lblMsg" runat="server" Text=""></asp:Label>
                      </td>
                     </tr>          
                </table>
                
            </div>
            
             
        </div>
    </div>
    <script type="text/javascript" language="javascript">
        function CheckForm()
        {
             var form = document.forms[0];
            if (!checkPwd(form.ctl00$ContentPlaceHolder1$txtOldPwd,"msgOldPwd")) {
                form.ctl00$ContentPlaceHolder1$txtOldPwd.focus();
                return false;
            }
            if (!checkPwd(form.ctl00$ContentPlaceHolder1$txtNewPwd,"msgNewPwd")) {
                form.ctl00$ContentPlaceHolder1$txtNewPwd.focus();
                return false;
            }
            if (!checkPwd2(form.ctl00$ContentPlaceHolder1$txtNewPwd1,"mgsNewPwd2")) {
                form.ctl00$ContentPlaceHolder1$txtNewPwd1.focus();
                return false;
            } 
            return true;
        }
        function checkPwd(obj,msgName) {
            var pass = false;
            var msg = document.getElementById(msgName);
            if (obj.value == "" || obj.value.length < 6 || obj.value.length > 16) {
                msg.innerHTML = "密码长度必须为6-16个字符";
            } else {
                pass = true;
                msg.innerHTML = "&nbsp;";
            }
            if (!msgFunc(pass, obj, msg)) {
                return false;
            }
            return true;
        }
        function checkPwd2(obj,msgName) {
            var pass = false;
            var msg = document.getElementById(msgName);
            var pwd = document.getElementById("ctl00_ContentPlaceHolder1_txtNewPwd");
            if (obj.value == "") {
                msg.innerHTML = "请再输入一遍您上面输入的密码";
            } else if (pwd.value != obj.value) {
                msg.innerHTML = "两次输入的密码不一致，请重新输入";
                obj.value = "";
            } else if (obj.value == "" || obj.value.length < 6 || obj.value.length > 16) {
                msg.innerHTML = "密码长度必须为6-16个字符";
            } else {
                pass = true;
                msg.innerHTML = "&nbsp;";
            }
            if (!msgFunc(pass, obj, msg)) {
                return false;
            }
            return true;
        }
        function msgFunc(pass, obj, msg) {
            if (pass == false) {//不通过
                
                msg.setAttribute("class", "reginfo_tr4");
                return false;
            } else { 
                msg.className = "reginfo_trcheck";
                return true;
            }
        }
    </script>
</asp:Content>

